<extend name="Public/Dialog/Common"/>
<block name="pageContent">
    <div class="bjui-pageContent">
        <form action="{:U('', I())}" class="pageForm" data-toggle="validate" method="post">
            <!-- 菜单id号 -->
            <input type="hidden" name="id" value="{:I('get.id')}">
            <table class="table table-condensed table-hover">
                <tbody>
                <tr>
                    <td colspan="2" align="center">
                        <h3>
                            添加/编辑操作                        </h3>
                    </td>
                </tr>
                <tr>
                        <td>
                            <label class="control-label x90">标题：</label>

                                                            <input type="text" data-rule="required" size="20" name="title" value="{$vo.title}">                        </td>
                    </tr><tr>
                        <td>
                            <label class="control-label x90">详情：</label>

                            <div class="panel-body">
                                <label class="textarea">
                                    <textarea name="details" data-toggle="kindeditor" data-minheight="200" style="width: 800px;">{$vo['details']}</textarea>
                                </label>
                            </div>


                                                 </td>
                    </tr>
                <tr>
                    <td>
                        <label class="control-label x90">地址：</label>
                        <input type="text" data-rule="required" size="20" name="address" value="{$vo.address}">
                    </td>
                </tr>
                    <tr>
                        <td>
                        <label class="control-label x90">是否收费：</label>
                        <input  <if  condition="$vo.cost eq 0">checked="checked"</if> type="radio" data-rule="required" size="20" name="cost" value="0">
                        免费
                        <input <if  condition="$vo.cost eq 1">checked="checked"</if>  type="radio" data-rule="required" size="20" name="cost" value="1">
                        收费
                        </td>
                    </tr>
                <tr id="price">
                    <td>
                        <label class="control-label x90">价格：</label>
                        <input  type="text" data-rule="required" size="20" name="price" value="{$vo.price}">
                    </td>
                </tr>
                <tr>
                    <td>
                        <label class="control-label x90">商品类型：</label>
                        <input  <if  condition="$vo.type eq 1">checked="checked"</if> type="radio" data-rule="required" size="20" name="type" value="1">
                        HR沙龙
                        <input <if  condition="$vo.type eq 2">checked="checked"</if>  type="radio" data-rule="required" size="20" name="type" value="2">
                        劳动法沙龙
                        <input  <if  condition="$vo.type eq 3">checked="checked"</if> type="radio" data-rule="required" size="20" name="type" value="3">
                        职涯沙龙
                    </td>
                </tr>
                <tr>
                    <td>
                        <label class="row-label">开始结束时间</label>
                        <div class="row-input">
                            <input name="start_time" type="text" <if condition='$vo.start_time neq 0'> value="{:date('Y-m-d H:i',$vo['start_time'])}" <else/> value="{:date('Y-m-d H:i')}"</if> data-toggle="datepicker" data-pattern="yyyy-MM-dd HH:mm:ss">
                            <input name="end_time" type="text" <if condition='$vo.end_time neq 0'> value="{:date('Y-m-d H:i',$vo['end_time'])}" <else/> value="{:date('Y-m-d H:i')}"</if> data-toggle="datepicker" data-pattern="yyyy-MM-dd HH:mm:ss">
                        </div>
                    </td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
    <script>
        //免费是价格设置为0
        $(function () {
            var price=$("input[name='price']");
            if(price.val()==''){
                price.val(0) ;
            }
            console.log(price.val());
        });

//        动态设置时间插件的时间选择
        $('.row-input').click(function () {
            setTimeout(function () {
                $('.hh.form-control').prop("disabled", false);
            },500)
        })
        $('input[name="cost"]').change(function () {
            if($(this).val()==0){
                $('#price').css('display','none');
                $('#price input').val(0);

            }else if($(this).val()==1){
                $('#price').css('display','block');
            }
        });
        $(function () {
            var _this=$('input[name="cost"]');
            if(_this.val()==0){
                $('#price').css('display','none');
            }else if(_this.val()==1){
                $('#price').css('display','block');
            }
        })
    </script>
</block>